<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    const obj = {
        name: 'mystic',
        [Symbol.iterator]: function () {
            const keys = Object.keys(this)
            let index = 0
            return {
                next: () => {
                    if (index < keys.length) {
                        return {
                            value: this[keys[index++]],
                            done: index < keys.length
                        }
                    } else {
                        return {
                            done: true
                        }
                    }
                }
            }
        }
    }

    for (let item of obj) {
        console.log(item)
    }

</script>

</html>